home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 May: Tool Chest / Dev.CD May 98 TC.toast / Tool Chest / Testing & Debugging / Networks / StopXPP dcmd / StopXpp.c next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  1.8 KB  |  83 lines  |  [TEXT/MPS ]

  1. /*     StopXPP.c
  2.  
  3.     This is a the StopXPP DCMD to close all open ASP sessions that is
  4.     compatible with AppleTalk version 55 and above.
  5.  
  6.     Copyright © 1991 Apple Computer, Inc.  All rights reserved.
  7.  
  8.     Modification history:
  9.         08/04/91 mbs        written from drvr.c
  10.  
  11.     The following MPW commands will build the dcmd and copy it to the
  12.     "Debugger Prefs" file in the System folder. The dcmd's name in
  13.     MacsBug will be the name of the file built by the Linker.
  14.     You must first copy dcmd.h, Put.c.o, dcmdGlue.a.o and DRunTime.o from the
  15.     C Samples folder into this folder.
  16.  
  17.     C -i "{AIncludes}" -r -b2 StopXPP.c
  18.     Link dcmdGlue.a.o StopXpp.c.o put.c.o DRuntime.o ∂
  19.             "{Libraries}"Interface.o -o StopXPP
  20.     BuildDcmd StopXPP 1005
  21.     Echo 'include "StopXPP";'    |    Rez -a -o "{systemFolder}Debugger Prefs"
  22. */
  23.  
  24. #ifdef USESTDIO
  25. #include <stdio.h>
  26. #endif
  27.  
  28. #include <Types.h>
  29. #include <Memory.h>
  30. #include <Devices.h>
  31. #include <SysEqu.h>
  32. #include <AppleTalk.h>
  33.  
  34. #include "dcmd.h"
  35. #include "put.h"
  36.  
  37. static XPPPrmBlk XPPPB;
  38.  
  39.  
  40. pascal void CommandEntry(dcmdBlock* paramPtr)
  41. {
  42.     OSErr err;
  43.     
  44.     switch (paramPtr->request)
  45.     {
  46.         case dcmdInit:
  47.             XPPPB.ioResult = 0;                    // Pre-load Param block
  48.             XPPPB.ioRefNum = xppRefNum;
  49.             XPPPB.csCode = closeAll;
  50.             XPPPB.ioCompletion = 0;
  51.             break;
  52.  
  53.         case dcmdHelp:
  54.             dcmdDrawLine("\pStopXPP");
  55.             dcmdDrawLine("\p   Closes any open file server connections.");
  56.             break;
  57.  
  58.         case dcmdDoIt:
  59.             if (XPPPB.ioResult > 0)
  60.             {
  61.                 dcmdDrawLine("\pStopXPP dcmd already in progress.");
  62.             }
  63.             else
  64.             {
  65.                 PutPStr("\pIssuing ACloseAll to .XPP");
  66.                 err = PBControl((ParmBlkPtr)&XPPPB, 1);
  67.                 if (err)
  68.                 {
  69.                     PutPStr("\p. Error returned was ");
  70.                     PutUDec(err);
  71.                 }
  72.                 PutLine();
  73.             }
  74.             break;
  75.  
  76.         default:
  77.             PutPStr("\pUnknown request ");
  78.             PutUDec(paramPtr->request);
  79.             PutLine();
  80.             break;
  81.     }
  82. } // CommandEntry
  83.